<link rel="stylesheet" href="../../common/ztree/css/demo.css" type="text/css">
<link rel="stylesheet" href="../../common/layui/css/layui.css">
<link rel="stylesheet" href="../../common/ztree/css/metroStyle/metroStyle.css" type="text/css">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>修改{tableComment}</legend>
</fieldset>

<form class="layui-form" action="">
    <input type="hidden" name="id" id="id">
    {field}
    <div class="layui-form-item">
        <div class="layui-form-item">
            <label class="layui-form-label">{fieldComment}</label>
            <div class="layui-input-inline">
                <input type="text" name="{lowCaseFieldName}" id="{lowCaseFieldName}" lay-verify="{lowCaseFieldName}" placeholder="请输入{fieldComment}" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux"></div>
        </div>
    </div>
    {/field}
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="submit">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="button" id="back" class="layui-btn layui-btn-danger">返回</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="../../common/ztree/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../../common/ztree/js/jquery.ztree.core.js"></script>
<script type="text/javascript" src="../../common/ztree/js/jquery.ztree.excheck.js"></script>
<script type="text/javascript" src="../../common/ztree/js/jquery.ztree.exedit.js"></script>
<script src="../../common/layui/layui.js"></script>
<script src="../../app/app.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function() {
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;
        //监听提交
        form.on('submit(submit)', function(data){
            post("../../../{lowCaseClassName}/edit",data.field,function (res) {
                layer.alert("修改成功",function () {
                    history.back();
                });
            });
            return false;
        });
        initValue();
        function initValue() {
            get("../../../{lowCaseClassName}/load?id="+getParams("id"),function (res) {
                {field}
                $("#{lowCaseFieldName}").val(res.{lowCaseFieldName});
                {/field}
                form.render();
            });
        }
    });
    //返回按钮事件
    $("#back").click(function () {
        window.history.back(-1);
    });

</script>